<% if flash[:notice] %>
    <div id="notice"><%= flash[:notice] %></div>
<% end %>

<%# if !CulturalHeritage::CollectionsController.my_notice.blank? %>
    <div ><%= CulturalHeritage::CollectionsController.my_notice %></div>
<%# end %>

<%= form_for @cultural_heritage_collection_photo, :url=>{:action=>'create_photo'},  :html => { :multipart => true } do |f| %>
  <% if @cultural_heritage_collection_photo.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@cultural_heritage_collection_photo.errors.count, "error") %> prohibited this cultural_heritage_collection_photo from being saved:</h2>

      <ul>
      <% @cultural_heritage_collection_photo.errors.full_messages.each do |msg| %>
        <li><%= msg %></li>
      <% end %>
      </ul>
    </div>
  <% end %>
<div class="shadow">  
  <fieldset id="agrupacion">
    <legend>Fotos</legend>

    <fieldset class="column-left">
      <div class="field">
        <label>Título para todas las fotos:</label>
        <%= f.text_field :title %>
        <br />
        <span>Si se deja vac&iacute;o se usar&aacute; el nombre de archivo en su lugar.</span>
      </div>
      <div class="field">
        <label>Descripción para todas las fotos:</label>
        <%= f.text_area :description, :rows => "4", :cols => "30" %>
      </div>
    </fieldset>

    <fieldset class="column-right">
      <div class="field">
        <label>Seleccione las fotos a cargar:</label>
        <%= file_field_tag 'cultural_heritage_collection_photo[photo][]', :id => 'cultural_heritage_collection_photo_photo',  :multiple => true %>
        <%#= f.file_field :photo %>
      </div>

      <!-- This is where the output will appear -->
      <div id="files_list"></div>

    </fieldset>
    <%= hidden_field_tag :id, @cultural_heritage_collection.id  %>
  </fieldset>
    <div class="actions">
      <%= f.submit "Enviar" %>
    </div>
</div>
<% end %>

<%#= link_to 'Regresar',{:action => 'show',:id => @cultural_heritage_collection_photo.collection}%>

<script type="text/javascript">
    var is_msie = false; var files_max = 1;
    //El name propio del modelo
    var name_file_input = "cultural_heritage_collection_photo[photo][]";
    if (navigator.appName == "Microsoft Internet Explorer"){
        is_msie = true;
        files_max = 50;
    }

    <!-- Create an instance of the multiSelector class, pass it the output target and the max number of files -->
    var multi_selector = new MultiSelector( document.getElementById( 'files_list' ), files_max );
    <!-- Pass in the file element -->
    multi_selector.addElement( document.getElementById( 'cultural_heritage_collection_photo_photo' ) );
</script>